<%@page import="java.util.Date"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<!-- 没有组织架构的用户弹出列表 -->
<title>使用人</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
	var ctx = 'http://localhost:8080';
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
</script>
</head>
<body>
	<form:form id="searchForm" modelAttribute="user" action="${ctx}/sys/user/dialogUserList?doDataFilter=false" method="post" class="breadcrumb form-search ">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<input type="hidden" name="officeId" value="${param.officeId }"/>
		<input type="hidden" name="doDataFilter" value="${param.doDataFilter }"/>
		<sys:tableSort id="orderBy" name="orderBy" value="${page.orderBy}" callback="page();"/>
		<table class="t-search">
			<tr>
				<td>姓&nbsp;&nbsp;&nbsp;名：</td>
				<td>
					<form:input path="name" htmlEscape="false" maxlength="50" class="input-search"/>
				</td>
				<td></td>
				<td>
					
				</td>
				<td class="tb-btn">
					<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" onclick="return page();"/>
				</td>
			</tr>
		</table>
	</form:form>
	
	<!-- <sys:message content="消息" /> -->
	<div class="css-dialog-tl">
	<table id="contentTable"
		class="table table-striped table-bordered table-condensed jqgrid-select">
		<thead>
			<tr>
				<th style="width:20px;"><input class="checkall" type="checkbox"/></th>
				<th class="sort-column login_name">登录名</th>
				<th class="sort-column name">姓名</th>
				<th>归属部门</th>
				<th>归属公司</th>
			</tr>
		</thead>
		<tbody>
			<c:if test="${empty page.list}">
				<tr>
					<td colspan=4 class="center">没有数据</td>
				</tr>
			</c:if>
			<c:forEach items="${page.list}" var="supplier">
			<tr>
				<td>
					<input type="checkbox"/>
					<input type="hidden" name="id" value="${user.id}"/>
					<input type="hidden" name="name" value="${user.name}"/>
				</td>
				<td>${user.loginName}</td>
				<td>${user.name}</td>
				<td>${user.office.name}</td>
				<td>${user.company.name}</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<script>
		var selects=false; //false 单选   true 可以多选
		
		if(selects){
			$(".checkall").removeAttr("disabled");
		}else{
			$(".checkall").attr("disabled","disabled");
		}
		
		$(".jqgrid-select tr").click(function(){
			if(selects){
				if($(this).hasClass("jdselect")){
					$(this).removeClass("jdselect");
					$(this).find("td:first input[type=checkbox]").removeAttr("checked");
				}else{
					$(this).addClass("jdselect");
					$(this).find("td:first input[type=checkbox]").attr("checked","true");
				}
			}else{
				$(this).addClass("jdselect");
				$(this).find("td:first input[type=checkbox]").attr("checked","true");
				$(this).siblings().removeClass("jdselect");
				$(this).siblings().find("td:first input[type=checkbox]").removeAttr("checked");
			}
		});
		
		$(".checkall").click(function(){
			if($(this).is(":checked")){
				$(this).parents("table").find("tr:gt(0)").addClass("jdselect");
				$(this).parents("table").find("tr:gt(0)").find("td:first input[type=checkbox]").attr("checked","true");
			}else{
				$(this).parents("table").find("tr:gt(0)").removeClass("jdselect");
				$(this).parents("table").find("tr:gt(0)").find("td:first input[type=checkbox]").removeAttr("checked");
			}
		});
		
	</script>
	</div>
	<div class="pagination">${page}</div>
</body>
</html>